/**
 * @param {number[]} nums
 * @return {number}
 */
var maxFrequencyElements = function(nums) {
    let map = new Map()
    for(let i = 0; i < nums.length; i++) {
        let t = nums[i]
        if(map.has(t)) map.set(t, map.get(t) + 1)
        else map.set(t, 1)
    }
    let max = 0
    let res = 0
    map.forEach((val, key) => {
        if(val > max) max = val
    })
    map.forEach((val, key) => {
        if(val == max) res += val
    })
    return res
};
console.log(maxFrequencyElements([15]));
console.log(maxFrequencyElements([1,2,2,3,1,4]));